package com.king01.controller;

import com.king01.entity.Goods;
import com.king01.entity.Inventory;
import com.king01.service.InventoryService;
import com.king01.vo.GoodsVo;
import com.king01.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @author：张梓康
 * @date：Created in 2023/10/11 9:56
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/inventory")
public class InventoryController {
    @Autowired
    private InventoryService inventoryService;

    @RequestMapping("/insert")
    public Result insert(@RequestBody List<Inventory> inventoryList) {
        return inventoryService.insert(inventoryList);
    }
    @RequestMapping("/list")
    public Result list(Integer currentPage, Integer pageSize){
        Result result = inventoryService.findAll(currentPage, pageSize);
        return result;
    }
    @RequestMapping("/list1")
    public Result list1(Integer currentPage, Integer pageSize, @RequestBody Inventory inventory){
        Result result = inventoryService.selectAll(currentPage, pageSize, inventory);
        return result;
    }

    @RequestMapping("/list2")
    public Result list2(Integer currentPage, Integer pageSize,String[] date, Integer branchid){
        System.out.println(date+"================================");
        Result result = inventoryService.findAllBySt(currentPage, pageSize,date,branchid);
        return result;
    }

    @RequestMapping("/pass")
    public Result pass(@RequestBody Inventory inventory){
        Result result = inventoryService.passInventory(inventory);
        return result;
    }

    @RequestMapping("/goodslist")
    public Result goodslist(Integer currentPage, Integer pageSize,Integer invenid){
        Result result = inventoryService.findAllXQ(currentPage, pageSize,invenid);
        return result;
    }

    @RequestMapping("/reject")
    public Result reject(@RequestBody Inventory inventory){
        Result result = inventoryService.rejectInventory(inventory);
        return result;
    }
}
    